Thực đơn
Canvas (phần tử HTML5) Ví dụĐoạn mã sau tạo ra một phần tử canvas trong trang HTML:
<canvas id="example" width="200" height="200">Đoạn văn bản này hiển thị vì trình duyệt của bạn không hỗ trợ HTML5 Canvas.</canvas>
dùng javascript, bạn có thể vẽ lên canvas:
var example = document.getElementById('example');var context = example.getContext('2d');context.fillStyle = 'red';context.fillRect(30, 30, 50, 50);
(đoạn mã trên vẽ một hình chữ nhật màu đỏ)
Thực đơn
Canvas (phần tử HTML5) Ví dụLiên quan
Tài liệu tham khảo
WikiPedia: Canvas (phần tử HTML5) http://developer.apple.com/documentation/AppleAppl... http://arstechnica.com/software/news/2008/08/mozil... http://dev.opera.com/articles/view/html-5-canvas-t... http://dev.opera.com/articles/view/svg-or-canvas-c... http://www.w3.org/TR/2009/WD-html5-20090825/the-ca... http://www.whatwg.org/specs/web-apps/current-work/... https://developer.mozilla.org/en/Canvas_tutorial